package org.example.创建型模式.抽象工厂模式.重构代码.Redis双集群升级_抽象工厂.factory.impl;

import org.example.创建型模式.抽象工厂模式.基层.Redis双集群升级_抽象工厂.matter.EGM;
import org.example.创建型模式.抽象工厂模式.重构代码.Redis双集群升级_抽象工厂.factory.ICacheAdapter;

import java.util.concurrent.TimeUnit;

/**
 * @author : hmxchen
 * @program : modules-api
 * @description :
 * @create : 2022-04-14 09:50
 **/
public class EGMCacheAdapter implements ICacheAdapter {
    private EGM egm = new EGM();

    public String get(String key) {
        return egm.gain(key);
    }

    public void set(String key, String value) {
        egm.set(key, value);
    }

    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key, value, timeout, timeUnit);
    }

    public void del(String key) {
        egm.delete(key);
    }
}
